package com.yoj.questionservice.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yoj.common.common.DeleteRequest;
import com.yoj.model.dto.question.QuestionAddRequest;
import com.yoj.model.dto.question.QuestionQueryRequest;
import com.yoj.model.dto.question.QuestionUpdateRequest;
import com.yoj.model.dto.questionsubmit.QuestionSubmitAddRequest;
import com.yoj.model.entity.Question;
import com.yoj.model.vo.QuestionVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author admin
 * @description 针对表【question(题目表)】的数据库操作Service
 * @createDate 2024-06-29 15:45:07
 */
public interface QuestionService extends IService<Question> {

    /**
     * 校验题目字段
     */
    void validQuestion(Question question, boolean add);

    /**
     * 获取查询包装类
     */
    QueryWrapper<Question> getQueryWrapper(QuestionQueryRequest questionQueryRequest);

    /**
     * 获取题目封装
     */
    QuestionVO getQuestionVO(Question question, HttpServletRequest request);

    /**
     * 分页获取题目封装
     */
    Page<QuestionVO> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);

    /**
     * 分页查询题目列表
     */
    Page<QuestionVO> getQuestionVOPage(QuestionQueryRequest questionQueryRequest, HttpServletRequest request);

    /**
     * 分页查询题目列表（管理员）
     */
    Page<Question> getQuestionPage(QuestionQueryRequest questionQueryRequest);

    /**
     * 新增题目
     */
    Long addQuestion(QuestionAddRequest questionAddRequest, HttpServletRequest request);

    /**
     * 删除题目
     */
    Boolean deleteQuestion(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 修改题目（仅管理员）
     */
    Boolean updateQuestion(QuestionUpdateRequest questionUpdateRequest);

    /**
     * 根据 id 获取题目
     */
    Question getQuestionById(long questionId, HttpServletRequest request);

    /**
     * 根据 id 获取题目视图
     */
    QuestionVO getQuestionVOById(long questionId, HttpServletRequest request);

    /**
     * 分页查询当前用户创建的题目列表
     */
    Page<QuestionVO> getUserQuestionVOPage(QuestionQueryRequest questionQueryRequest, HttpServletRequest request);

    /**
     * 提交题目
     */
    Long submitQuestion(QuestionSubmitAddRequest questionSubmitAddRequest, HttpServletRequest request);

}